package com.java.day03;

import java.util.Scanner;

/**
 * 用户输入任意一个整数，求各位数字之和
 */
public class practise03 {
    public static void main(String[] args) {
        //任意整数
        int number;
        //求和
        int sum=0;
        System.out.println("请输入任意整数:");

        Scanner scanner = new Scanner(System.in);
        number = scanner.nextInt();


        for ( ; ; ) {
            sum+=number % 10;
            number = number/10;
            if(number==0){
                System.out.println(sum);
                break;
            }
        }
    }
}
